{% extends "goods/base_goods.html" %}

{% block content %}
    <div class="breadcrumb">
        <a href="#">全部分类</a>
        <span>&gt;</span>
        <a href="#">{{ category.category_name }}</a>
    </div>
    <div class="main_wrap clearfix">
        <div class="l_wrap fl clearfix">
            <div class="new_goods">
                <h3>新品推荐</h3>
                <ul>
                    {% for new in news %}
                        <li>
                            <a href="/goods/detail/"><img src="{{ new.pic }}"></a>
                            <h4><a href="/goods/detail/">{{ new.goods.name }}</a></h4>
                            <div class="prize">{{ new.goods.price }}</div>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>

        <div class="r_wrap fr clearfix">
            <div class="sort_bar">
                <a href="/goods/list/{{ category.id }}/default/"
                        {% if sort == "default" %}
                   class="active"
                        {% endif %}>默认</a>
                <a href="/goods/list{{ category.id }}/price/"
                        {% if sort == "price" %}
                   class="active"
                        {% endif %}>价格</a>
                <a href="/goods/list/{{ category.id }}/popular/"
                        {% if sort == "popular" %}
                   class="active"
                        {% endif %}>人气</a>
            </div>

            <ul class="goods_type_list clearfix">
                {% for goods in page %}
                    <li>
                        <a href="/goods/detail/"><img src="{{ goods.pic }}"></a>
                        <h4><a href="/goods/detail/">{{ goods.goods_name }}</a></h4>
                        <div class="operate">
                            <span class="prize">{{ goods.price }}</span>
                            <span class="unit">{{ goods.price }}/{{ goods.until }}</span>
                            <a href="#" class="add_goods" title="加入购物车"></a>
                        </div>
                    </li>
                {% endfor %}
                <div class="pagenation">
                    {% if page.has_previous %}
                        <a href="/goods/list{{ category.id }}/{{ sort }}/{{ page.previous_page_number }}">&lt;上一页</a>
                    {% endif %}
                    {% for num in page.paginator.page_range %}
                        {% if page_num == num %}
                             <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ num }}/" class="active">{{ num }}</a>
                        {% else %}
                             <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ num }}/">{{ num }}</a>
                        {% endif %}
                    {% endfor %}
                    {% if has.has_next %}
                        <a href="/goods/list/{{ category.id }}/{{ sort }}/{{ page.next_page_number }}">下一页&gt;</a>
                    {% endif %}
                </div>
            </ul>
        </div>
    </div>
{% endblock %}